package com.fzy.auth.action;

import java.util.LinkedList;
import java.util.List;

import org.apache.commons.lang.StringUtils;

import com.fzy.auth.entity.User;
import com.fzy.auth.query.UserQuery;
import com.fzy.auth.service.UserService;
import com.fzy.core.BaseAction;
import com.fzy.core.entity.Display;
import com.opensymphony.xwork.ModelDriven;
import com.opensymphony.xwork.Preparable;

public class UserListAction extends BaseAction implements ModelDriven, Preparable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1749240209994548252L;

	List list;
	UserQuery userQuery;
    UserService userService;
    
	public void prepare() throws Exception {
		userQuery = new UserQuery();
		list = new LinkedList();
//		userQuery.setName("请输入");
	}
	
	public void validate() {
		validateSelectQuery(User.class);
	}

	public String execute() throws Exception {
		if(userQuery.isExecution())
			list = userService.list(userQuery);
		
		return "dispatcher:/WEB-INF/jsp/auth/user-list.jsp";
    }

	public void setUserService(UserService userService) {
		this.userService = userService;
	}

	public Object getModel() {
		return userQuery;
	}

	public List getList() {
		return list;
	}

	public UserQuery getUserQuery() {
		return userQuery;
	}
	
}
